The <div> Element
<div> উপাদানটি ডিফল্টভাবে একটি ব্লক উপাদান, যার অর্থ এটি সমস্ত উপলব্ধ প্রস্থ গ্রহণ করে এবং অগ্রণী এবং পরবর্তী লাইন বিরতির সাথে আসে।
Example
একটি <div> উপাদান সমস্ত উপলব্ধ প্রস্থ গ্রহণ করে:
HTML Code:
Lorem Ipsum <div>I am a div</div> dolor sit amet.
<div> উপাদানটির কোনো প্রয়োজনীয় বৈশিষ্ট্য নেই, তবে শৈলী, শ্রেণি এবং আইডি সাধারণ।
<div> as a container
<div> উপাদানটি প্রায়শই একটি ওয়েব পৃষ্ঠার অংশগুলিকে একত্রিত করতে ব্যবহৃত হয়।
Example
HTML উপাদান সহ একটি <div> উপাদান:
HTML Code:
<div>
<h2>London</h2>
<p>London is the capital city of England.</p>
<p>London has over 9 million inhabitants.</p>
</div>
London
London is the capital city of England.
London has over 9 million inhabitants.
Center align a <div> element
আপনার যদি এমন একটি <div> উপাদান থাকে যা 100% চওড়া না হয় এবং এটিকে কেন্দ্র-সারিবদ্ধ করতে চান, তাহলে CSS মার্জিন বৈশিষ্ট্য অটোতে সেট করুন।
Example
CSS and HTML Code:
<style>
div {
width:300px;
margin:auto;
}
</style>
<div>
<h2>London</h2>
<p>London is the capital city of England.</p>
<p>London has over 9 million inhabitants.</p>
</div>
London
London is the capital city of England.
London has over 9 million inhabitants.
Multiple <div> elements
একটি একক পৃষ্ঠাতে একাধিক <div> কন্টেইনার থাকতে পারে।
Example
HTML Code:
<div>
<h2>London</h2>
<p>London is the capital city of England.</p>
<p>London has over 9 million inhabitants.</p>
</div>
<div>
<h2>Oslo</h2>
<p>Oslo is the capital city of Norway.</p>
<p>Oslo has over 700,000 inhabitants.</p>
</div>
<div>
<h2>Rome</h2>
<p>Rome is the capital city of Italy.</p>
<p>Rome has over 4 million inhabitants.</p>
</div>
London
London is the capital city of England.
London has over 9 million inhabitants.
Oslo
Oslo is the capital city of Norway.
Oslo has over 700,000 inhabitants.
Rome
Rome is the capital city of Italy.
Rome has over 4 million inhabitants.
Aligning <div> elements side by side
ওয়েব পৃষ্ঠাগুলি তৈরি করার সময়, আপনি প্রায়শই দুটি বা ততোধিক <div> উপাদান পাশাপাশি রাখতে চান:
London
London is the capital city of England.
London has over 9 million inhabitants.
Oslo
Oslo is the capital city of Norway.
Oslo has over 700,000 inhabitants.
Rome
Rome is the capital city of Italy.
Rome has over 4 million inhabitants.
উপাদানগুলিকে পার্শ্বীয়ভাবে সারিবদ্ধ করার জন্য বিভিন্ন পদ্ধতি রয়েছে, সমস্ত কিছু CSS স্টাইলিং জড়িত। আমরা সবচেয়ে সাধারণ পদ্ধতিগুলি দেখব:
| Method | Description | Example Code |
|---|---|---|
| Float | CSS ফ্লোট অ্যাট্রিবিউটটি মূলত <div> উপাদানগুলিকে পার্শ্বীয়ভাবে সারিবদ্ধ করার জন্য তৈরি করা হয়নি, কিন্তু বছরের পর বছর ধরে এই উদ্দেশ্যে ব্যবহার করা হয়েছে। |
|
| Inline-block | আপনি যদি <div> এলিমেন্টের ডিসপ্লে অ্যাট্রিবিউট ব্লক থেকে ইনলাইন-ব্লক এ পরিবর্তন করেন, তাহলে <div> এলিমেন্ট লিডিং এবং ট্রেইলিং লাইন স্পেসিং যোগ করে না এবং একে অপরের উপরে না হয়ে পাশের দিকে প্রদর্শিত হয়। |
|
| Flex | সিএসএস ফ্লেক্সবক্স লেআউট মডিউলটি ফ্লোটিং বা পজিশনিং ব্যবহার না করে নমনীয় প্রতিক্রিয়াশীল লেআউট ডিজাইন করা সহজ করার জন্য চালু করা হয়েছিল। |
|
| Grid | CSS গ্রিড লেআউট মডিউল সারি এবং কলাম সহ একটি গ্রিড-ভিত্তিক লেআউট প্রদান করে, যা ভাসমান এবং অবস্থান ব্যবহার না করে ওয়েব পৃষ্ঠাগুলি ডিজাইন করা সহজ করে তোলে। |
|
পরামর্শ:
ফ্লোট, ফ্লেক্স এবং গ্রিড সম্পর্কে আরও জানতে আমাদের CSS টিউটোরিয়াল দেখুন। jassif টিম বিস্তারিত উদাহরণ সহ এই সমস্ত পদ্ধতি প্রদান করে।
Exercise
নিম্নলিখিত কোড বিবেচনা করুন:
<div style='width:200px;margin:auto'>
<h2>London</h2>
</div>
London
কিভাবে DIV উপাদান সারিবদ্ধ করা হবে?
HTML Tags
| Tag | Description |
|---|---|
<div> |
একটি নথিতে একটি বিভাগ সংজ্ঞায়িত করে (বিভাগ-স্তর)। |
দ্রষ্টব্য:
সমস্ত উপলব্ধ HTML ট্যাগের সম্পূর্ণ তালিকার জন্য, আমাদের HTML ট্যাগ রেফারেন্স দেখুন।